function [ D ] = DivergDist( A, B )
    %avoid division by zero
    A = A + 1e-6;
    B = B + 1e-6;
    part1 = sum(sum(A .* log( A ./ B) - A + B));
    
    part2 = sum(sum(B .* log( B ./ A) - B + A));
    
    D = part1 + part2;
    
end

